using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace MusicmanWeb
{
    public class MusicmanPage : System.Web.UI.Page
    {
        virtual protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected string GetAppServer()
        {
            String path = "http://" + System.Web.HttpContext.Current.Request.Url.Host;
            if (System.Web.HttpContext.Current.Request.Url.Port != 80)
            {
                path += ":" + System.Web.HttpContext.Current.Request.Url.Port;
            }
            path += System.Web.HttpContext.Current.Request.ApplicationPath.ToLower();
            if (!path.EndsWith("/"))
            {
                path += "/";
            }
            return path;
        }

        protected void ReddirectNonActiveSession()
        {

            Response.Expires = -1000; // Makes the browser not cache this page
            Response.Buffer = true; //Buffers the content so our Response.Redirect will work            

            if (Session["UserID"] == null)
            {
                Session.Abandon();
                FormsAuthentication.SignOut();
                FormsAuthentication.RedirectToLoginPage();
                Response.End();
            }
        }
    }
}
